package homework;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class HomeWorkReducer extends Reducer<LongWritable, NullWritable, Text, NullWritable> {
    private final Text text = new Text();
    private int num = 1;

    @Override
    protected void reduce(LongWritable key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
        for (NullWritable value : values) {
            text.set(num++ + "\t" + key.toString());
            context.write(text, value);
        }
    }
}
